
//创建一个函数module，我们需要需要通过这个函数来生成符合模态框的模板字符串
function module(title, msg) {
    //模态框的HTML模板字符串
    let info = `
    <span class="close">×</span>
        <h3 class="message-title">${title}</h3>
        <p class="message-content">
            ${msg}
        </p>
    `;
    return info;
}
function init(title, msg) {
    let strInfo = module(title, msg);
    let message = document.getElementsByClassName('message')[0];
    message.style.display = 'block';
    message.innerHTML = strInfo;
    //点击关闭按钮，模态框消失
    let closeBtn = document.getElementsByClassName('close')[0];
    closeBtn.onclick = function() {
        message.style.display = 'none';
    }
}